<?php  

require('./conn.php');

$id = $_GET['id'];
if(empty($_POST)){

	$sql = "select * from msg where id=$id";
	$ob = mysqli_query($conn,$sql);
	$row = mysqli_fetch_assoc($ob);
//print_r($row);
	require('./edit.html');
} else{
	$sql = "update msg set name='$_POST[name]',email='$_POST[email]',content='$_POST[content]' where id=$id";
	//print_r($sql);
	if(mysqli_query($conn,$sql)){
		//echo '修改成功';
		header("Location:02.php");
	} else{
		echo '修改失败';
	}
}


?>